package com.hm.hsw3;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

public class Test {
    public static void main(String[] args) {
        HashMap<Integer, String> iSHM = new HashMap<>();
        iSHM.put(1,"张三");
        iSHM.put(10,"李四");
        iSHM.put(5,"王五");
        System.out.println(iSHM);
        System.out.println(iSHM.size());
        //键找值的方式进行遍历打印
        Set<Integer> set = iSHM.keySet();
        set.forEach(k-> System.out.println(k+"->"+iSHM.get(k)));
        Set<Map.Entry<Integer, String>> entries = iSHM.entrySet();
        entries.forEach(integerStringEntry -> System.out.println(integerStringEntry.getKey() + "->" + iSHM.get(integerStringEntry.getKey())));
        String s = iSHM.get(1);
        System.out.println(s);
        String s1 = iSHM.get(10);
        System.out.println(s1);
        boolean b = iSHM.containsKey(10);
        System.out.println(b);
        String re = iSHM.remove(1);
        System.out.println(iSHM);
    }
}
